import Vue from "vue";
import VueRouter from "vue-router";
import App from "./App.vue";
import HmFind from "./components/HmFind.vue";
import HmFriend from "./components/HmFriend.vue";
import HmMy from "./components/HmMy.vue";

import FriendChild2 from "./components/FriendChild2.vue";
import FriendChild3 from "./components/FriendChild3.vue";
import FriendChild1 from "./components/FriendChild1.vue";
Vue.config.productionTip = false;

Vue.use(VueRouter);
const router = new VueRouter({
  routes: [
    // 重定向
    {
      path: "/find",
      component: HmFind,
    },
    { path: "/my", component: HmMy },
    {
      path: "/friend",
      component: HmFriend,
      //1.配置嵌套路由的规则
      //2.在父组件内，设置一个router-view了组件的挂载点
      children: [
        { path: "son1", component: FriendChild1 },
        { path: "son2", component: FriendChild2 },
        { path: "son3", component: FriendChild3 },
      ],
    },
  ],
});
new Vue({
  render: (h) => h(App),
  router: router,
}).$mount("#app");
